package com.well.register.console.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.well.register.console.domain.Job;
import com.well.register.console.domain.JobExecutor;
import com.well.register.console.model.job.QueryJobsParam;
import com.well.rpc.model.JobHandlerModel;
import com.well.rpc.model.RegisterModel;

import java.util.List;

/**
 * <p>
 * job service, 保存job任务
 * </p>
 *
 * @author weedo
 * @since 2022/7/31
 */


public interface JobService extends IService<Job> {

    /**
     * 保存job
     * @param model
     * @param registerModel
     */
    void saveJob(JobHandlerModel model, RegisterModel registerModel);

    /**
     * 通过注册模型和任务名查询job
     * @param jobName
     * @param registerModel
     * @return
     */
    Job getJob(String jobName, RegisterModel registerModel);

    /**
     * 通过注册模型查询job
     * @param registerModel
     * @return
     */
    List<Job> getJobs(RegisterModel registerModel);

    /**
     *  查询job(管理面)
     * @param param
     * @return
     */
    List<Job> selectJobLists(QueryJobsParam param);

    /**
     *  停止 job(管理面)
     * @param id
     */
    boolean stopJobById(Integer id);

    /**
     * 重启job任务
     * @param id
     */
    boolean restartJobById(Integer id);

    /**
     * 立即执行任务
     * @param id
     */
    boolean startJobNow(Integer id);
}
